package com.jiahua.admin.biz.action.inventory.image;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.Result;

public class CustomImageBytesResult implements Result {

	private static final long serialVersionUID = -50817243903454297L;

	public void execute(ActionInvocation invocation) throws Exception {
		ImageReceiveAction action = (ImageReceiveAction) invocation.getAction();
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setContentType(action.getCustomContentType());
		response.getOutputStream().write(action.getCustomImageInBytes());
		response.getOutputStream().flush();
	}
}